import { ref } from 'vue'
import type { Annotation } from '../types'

export function useAnnotationTable() {
  const annotations = ref<Annotation[]>([
    {
      id: "1",
      location: '第3页',
      type: '格式问题',
      description: '章节标题未使用标准格式，建议使用一级标题样式',
      severity: '警告',
      status: '已处理'
    },
    {
      id: "2",
      location: '第5页',
      type: '内容缺失',
      description: '未包含供应商资质要求条款，请补充',
      severity: '严重',
      status: '待处理'
    },
    {
      id: "3",
      location: '第7页',
      type: '合规问题',
      description: '付款条款不符合公司政策，应调整为30天账期',
      severity: '严重',
      status: '待处理'
    },
    {
      id: "4",
      location: '第8页',
      type: '逻辑问题',
      description: '验收标准与交付要求存在矛盾，请核实',
      severity: '警告',
      status: '已处理'
    },
    {
      id: "5",
      location: '第12页',
      type: '数据问题',
      description: '预算金额与明细表合计不一致，请核对',
      severity: '严重',
      status: '待处理'
    }
  ])

  const getSeverityClass = (severity: string): string => {
    return severity === '严重' ? 'marker-error' : 'marker-warning'
  }

  const getStatusClass = (status: string): string => {
    return status === '已处理' ? 'marker-success' : 'marker-warning'
  }

  return {
    annotations,
    getSeverityClass,
    getStatusClass
  }
}